package com.zzty.txj.controller;


import com.zzty.txj.entity.Test;
import com.zzty.txj.entity.User;
import com.zzty.txj.service.TestService;
import com.zzty.txj.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/test")
public class TestController {


   @Autowired
    UserService userServiceImpl;
TestService testServiceImpl;

    @ResponseBody
    @RequestMapping(value="/insertTo", method=RequestMethod.POST)
    public Integer insertTo(Test test, ModelMap model) {

        Integer count=testServiceImpl.addUser(test);
        return count;
    }

    @ResponseBody
    @RequestMapping(value="/getUserById")
    public User getUserById(User user, ModelMap model) {

         User user1 =userServiceImpl.getUserById(user.getId());;
        return  user1 ;
    }
}